package ch04.game;

/**
 * @author chenmin
 * @desc TODO
 * @date 2025/9/3
 */
/**
 * 怪兽类：继承Role抽象类，实现怪兽基础攻击逻辑与信息展示
 */
public class Monster extends Role {

    public Monster(String name, int level, int blood, String kind, int basePower, int baseDefence) {
        super(name, level, blood, kind, basePower, baseDefence);
    }

    @Override
    public void attack(Role target) {
        if (this.isDead()) {
            System.out.printf("【%s】已死亡，无法发起攻击！%n", getName());
            return;
        }
        if (target.isDead()) {
            System.out.printf("【%s】已死亡，无需继续攻击！%n", target.getName());
            return;
        }

        int damage = Math.max(MIN_DAMAGE, getTotalPower() - target.getTotalDefence());
        target.setBlood(target.getBlood() - damage);


        System.out.printf("【%s】发起攻击！对【%s】造成%d点伤害，【%s】剩余血量：%d%n",
                getName(), target.getName(), damage, target.getName(), target.getBlood());
    }

    @Override
    public void showBaseInfo() {
        super.showBaseInfo();
        System.out.println("角色类型：基础怪兽");
    }
}